package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-03-10
 * Time: 13:00
 */
public class Add implements Ioperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入书名");
        String bookName = scanner.nextLine();

        System.out.println("请输入作者");
        String author = scanner.nextLine();

        System.out.println("请输入价格");
        Double price = scanner.nextDouble();

        System.out.println("请输入书的类型");
        String type = scanner.next();

        Book book = new Book(bookName, author, price, type);
        bookList.setBook(bookList.getUsedSize(), book);
        bookList.setUsedSize(bookList.getUsedSize() + 1);
    }
}
